<style lang="scss" src="./index.scss"></style>
<style lang="scss" scoped>
.wgt-hd {
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
  }
  .sub-title {
    font-size: 10px;
    color: #666;
    margin-left: 4px;
  }
  .wgt-more {
    position: relative;
    width: 4px;
    height: 4px;
    background: #333;
    border-radius: 50%;
    margin-right: 10px;
    &:before {
      content: '';
      position: absolute;
      width: 4px;
      height: 4px;
      background: #333;
      border-radius: 50%;
      left: -8px;
    }
    &:after {
      content: '';
      position: absolute;
      width: 4px;
      height: 4px;
      background: #333;
      border-radius: 50%;
      right: -8px;
    }
  }
}
.wgt-bd {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  .nav-item {
    padding: 0 4px;
  }
  .nav-item--content {
    text-align: center;
    font-size: 13px;
    margin-top: 4px;
  }
}
.list-grid {
  display: flex;
  .lf-box {
    width: 50%;
    padding: 0 4px 0 8px;
  }
  .rg-box {
    width: 50%;
    padding: 0 8px 0 4px;
  }
  .item-box {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
  }
  .item-info {
    background-color: #fff;
    padding: 4px;
    font-size: 13px;
    position: relative;
    .brand-logo {
      position: absolute;
      left: 50%;
      top: -30px;
      transform: translateX(-50%);
      background: #fff;
      width: 64px;
      height: 64px;
      border-radius: 32px;
      padding: 2px;
    }
    .name {
      @include text-overflow();
    }
    .item-price {
      color: #222;
      margin-right: 4px;
    }
  }
}
.list-grids {
  padding: 0 4px;
  display: flex;
  flex-wrap: wrap;
  .item-box {
    border-radius: 8px;
    overflow: hidden;
    width: calc(33.3% - 8px);
    margin: 0 4px 8px 4px;
    background: #fff;
  }
  .item-info {
    background-color: #fff;
    padding: 4px;
    font-size: 13px;
    position: relative;
    .brand-logo {
      position: absolute;
      left: 50%;
      top: -30px;
      transform: translateX(-50%);
    }
    .name {
      @include text-overflow();
    }
    .item-price {
      color: #222;
      margin-right: 4px;
    }
  }
}

// .carousel{
  .carousela ::v-deep .el-carousel__indicator--horizontal .el-carousel__button {
    width: 14px;
    height: 14px;
    background: #C0C4CC;
    border: #C0C4CC;
    border-radius: 50%;
    opacity: 0.24;
  }
   .carousela ::v-deep .el-carousel__indicator--horizontal.is-active .el-carousel__button {
    width: 14px;
    height: 14px;
    background: #C0C4CC;
    border-radius: 50%;
    opacity: 1;
  }
  .carousela ::v-deep .el-carousel__indicators {
    // 指示灯位置
    left: unset;
    transform: unset;
    right: 2%;
  }
// }
// /deep/ .el-carousel__indicator--horizontal.is-active .el-carousel__button {
//   width: 14px;
//   height: 14px;
//   background: #ffffff;
//   border-radius: 50%;
//   opacity: 1;
// }
// /deep/ .el-carousel__indicators {
//   // 指示灯位置
//   left: unset;
//   transform: unset;
//   right: 2%;
// }


.wgt-headline {
  .wgt-content {
    line-height: 60px;
    font-size: 20px;
    color: #333;
    font-weight: 600;
    padding: 0 8px;
  }
  .left {
    text-align: left;
  }
  .center {
    text-align: center;
  }
}
</style>

<template>
  <div
    :class="{
      'wgt-headline': true,
      'padded': value.padded
    }"
  >
    <div v-if="value.title || value.subtitle" class="wgt-hd">
      <span class="title">{{ value.title }}</span>
      <span class="sub-title">{{ value.subtitle }}</span>
    </div>
    <div :class="value.dot?'carousela':''">
      <!-- 挂件自定义部分 -->
      <el-carousel height="180px" :autoplay="false" indicator-position="outside" arrow="never">
        <el-carousel-item v-for="carouselItem in value.data.length%10===0?(value.data.length/10):(parseInt(value.data.length/10)+1)" :key="carouselItem">
          <div v-for="bdItem in 2" :key="carouselItem+'-'+bdItem" class="wgt-bd">
            <div v-for="(item, index) in value.data" :key="`nav-item__${index}`">
              <div
                v-if="(index+1) <= (carouselItem-1)*10 + (bdItem*5) && (index+1) > ((carouselItem-1)*10)+((bdItem-1)*5) && (index+1) > (carouselItem-1)*10 "
                class="nav-item"
              >
                <div class="nav-image">
                  <SpImage :src="item.imgUrl" :circle="8"  />
                </div>
                <div v-if="item.content" class="nav-item--content">{{ item.content }}</div>
              </div>
            </div>
          </div>
        </el-carousel-item>
      </el-carousel>
      <!-- <div
        :class="[
          'wgt-content'
        ]"
      >
        <span> {{ value.title }} </span>
      </div> -->
      <!-- 挂件自定义部分 -->
    </div>
  </div>
</template>
<script>
import config from './config'
export default {
  name: 'WgtJnGridCarousel',
  wgtName: '分页导航',
  wgtDesc: '',
  wgtIcon: 'wgt-jn-grid-carousel',
  config: config,
  props: {
    pageNum: {
      type: Number,
      default: 2
    },
    value: [Object, Array]
  },
  computed: {
    
  },
}
</script>
